<template>
  <div>
    <div style="margin: 10px 0 20px 0; font-size: 30px; font-weight: bold">{{ news.title }}</div>
    <div style="margin: 10px 0; font-size: 13px; color: #666">{{ news.author }}  <span style="margin-left: 20px">{{ news.time }}</span></div>
    <div style=" box-shadow: 0 0 10px rgba(0, 0, 0, .12); padding: 10px">
      <div v-html="news.content" ></div>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import request from '@/utils/request';

const route = useRoute()
const news = ref({})
const id = route.query.id

onMounted(() => {
  if (!id) { return}
  request.get('/news/selectById/' + id).then(res => {
    news.value = res.data
  })
})

</script>
